class S2.UI.Dialog
Description
A class for showing dialogs on screen.
Options
zIndex
(Number
): The CSSz-index
for the dialog. Default is1000
.title
(String
): The text to display in the dialog's title bar. Default is"Dialog"
.content
(String
|Element
): The content to display as the body of the dialog. Strings can be plaintext or HTML; they'll be inserted as-is into the dialog. Ifcontent
refers to an element on the page, that element will be detached from its initial location when the dialog is instantiated.submitForms
(Boolean
): By default, a dialog will suppress theonsubmit
event of any forms included in the dialog's content (in order to prevent navigation to a new page). Set this totrue
to override this behavior.closeOnEscape
(Boolean
): Whether the dialog closes (with a "cancel" outcome) when the ESC key is pressed. Default istrue
.draggable
(Boolean
): Whether the dialog should be draggable (with the dialog's title bar as the handle). Default istrue
.resizable
(Boolean
): Whether the dialog should be resizable. Default isfalse
.buttons
(Array
|Boolean
): A set ofObject
s that describe the buttons that should appear at the bottom of the dialog. Set tofalse
to omit buttons.
Events
All events have a dialog
property (e.g., event.memo.dialog
) that
holds the relevant instance of S2.UI.Dialog
. Some events have further
properties, as explained below.
ui:dialog:before:open
: Fired when the dialog is told to open, but before it is displayed on screen. Cancelable. If cancelled, will suppress the display of the dialog.ui:dialog:after:open
: Fired just after the dialog is displayed on screen. Cannot be cancelled.ui:dialog:before:close
: Fired when the dialog is told to close (whether successfully or unsuccessfully), but before it has been hidden. Cancelable. If cancelled, will suppress the hiding of the dialog.ui:dialog:after:close
: Fired just after the dialog disappears from the screen. Cannot be cancelled. Thesuccess
property is a boolean that tells whether the dialog was closed in success. Theform
property (present if the dialog's content contained aFORM
element) holds anObject
serialization of the form's content.
Superclass
Includes
Constructor
new S2.UI.Dialog(element, options)
new S2.UI.Dialog(options)
If element
is given, that element will become the container for
the dialog. Otherwise, an element will be created to serve as the
container.
Note that the dialog is not displayed on screen when it is
created. You must explicitly call S2.UI.Dialog#open
first.